# -*- coding: utf-8 -*-
# @description: 
# @File  : server.py
# @Time  :2020-04-05 10:22:58
# @Author:selfeasy
# @Email :gm_selfeasy@163.com

from werkzeug.routing import Map, Rule
from werkzeug.wrappers import Request, Response

def get_message(request):
    return Response('路由'+ str(request.environ))

def get_number(request):
    return Response('123')
    
rule1 = Rule('/message', endpoint=get_message)
rule2 = Rule('/number', endpoint=get_number)

url_map = Map([rule1, rule2])

def app(env, start_response):
    request = Request(env)
    adapter = url_map.bind_to_environ(env)
    endpoint, values = adapter.match()
    resp = endpoint(request)
    return resp(env, start_response)





